# frozen_string_literal: true

class GithubPullEnrich < GithubBase

  include BaseEnrich
  include PullEnrich

  def self.index_name
    'github-pulls_enriched'
  end

  def self.mapping
    {"dynamic_templates"=>
     [{"notanalyzed"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"keyword"}}},
      {"formatdate"=>{"match"=>"*", "match_mapping_type"=>"date", "mapping"=>{"format"=>"strict_date_optional_time||epoch_millis", "type"=>"date"}}}],
     "properties"=>
     {"additions"=>{"type"=>"long"},
      "assignee_geolocation"=>{"type"=>"geo_point"},
      "author_bot"=>{"type"=>"boolean"},
      "author_domain"=>{"type"=>"keyword"},
      "author_gender"=>{"type"=>"keyword"},
      "author_gender_acc"=>{"type"=>"long"},
      "author_id"=>{"type"=>"keyword"},
      "author_multi_org_names"=>{"type"=>"keyword"},
      "author_name"=>{"type"=>"keyword"},
      "author_org_name"=>{"type"=>"keyword"},
      "author_user_name"=>{"type"=>"keyword"},
      "author_uuid"=>{"type"=>"keyword"},
      "changed_files"=>{"type"=>"long"},
      "closed_at"=>{"type"=>"date"},
      "code_merge_duration"=>{"type"=>"float"},
      "commits_data"=>{"type"=>"keyword"},
      "created_at"=>{"type"=>"date"},
      "deletions"=>{"type"=>"long"},
      "forks"=>{"type"=>"long"},
      "github_repo"=>{"type"=>"keyword"},
      "grimoire_creation_date"=>{"type"=>"date"},
      "id"=>{"type"=>"long"},
      "id_in_repo"=>{"type"=>"keyword"},
      "is_github_pull_request"=>{"type"=>"long"},
      "issue_url"=>{"type"=>"keyword"},
      "item_type"=>{"type"=>"keyword"},
      "labels"=>{"type"=>"keyword"},
      "linked_issues_count"=>{"type"=>"long"},
      "merge_author_domain"=>{"type"=>"keyword"},
      "merge_author_geolocation"=>{"type"=>"geo_point"},
      "merge_author_location"=>{"type"=>"keyword"},
      "merge_author_login"=>{"type"=>"keyword"},
      "merge_author_name"=>{"type"=>"keyword"},
      "merge_author_org"=>{"type"=>"keyword"},
      "merged"=>{"type"=>"boolean"},
      "merged_at"=>{"type"=>"date"},
      "merged_by_data_bot"=>{"type"=>"boolean"},
      "merged_by_data_domain"=>{"type"=>"keyword"},
      "merged_by_data_gender"=>{"type"=>"keyword"},
      "merged_by_data_gender_acc"=>{"type"=>"long"},
      "merged_by_data_id"=>{"type"=>"keyword"},
      "merged_by_data_multi_org_names"=>{"type"=>"keyword"},
      "merged_by_data_name"=>{"type"=>"keyword"},
      "merged_by_data_org_name"=>{"type"=>"keyword"},
      "merged_by_data_user_name"=>{"type"=>"keyword"},
      "merged_by_data_uuid"=>{"type"=>"keyword"},
      "metadata__enriched_on"=>{"type"=>"date"},
      "metadata__gelk_backend_name"=>{"type"=>"keyword"},
      "metadata__gelk_version"=>{"type"=>"keyword"},
      "metadata__timestamp"=>{"type"=>"date"},
      "metadata__updated_on"=>{"type"=>"date"},
      "num_review_comments"=>{"type"=>"long"},
      "num_review_comments_without_bot"=>{"type"=>"long"},
      "origin"=>{"type"=>"keyword"},
      "project"=>{"type"=>"keyword"},
      "project_1"=>{"type"=>"keyword"},
      "pull_request"=>{"type"=>"boolean"},
      "repository"=>{"type"=>"keyword"},
      "state"=>{"type"=>"keyword"},
      "tag"=>{"type"=>"keyword"},
      "time_open_days"=>{"type"=>"float"},
      "time_to_close_days"=>{"type"=>"float"},
      "time_to_first_attention_without_bot"=>{"type"=>"float"},
      "time_to_merge_request_response"=>{"type"=>"float"},
      "title"=>{"type"=>"keyword"},
      "title_analyzed"=>{"type"=>"text"},
      "updated_at"=>{"type"=>"date"},
      "url"=>{"type"=>"keyword"},
      "url_id"=>{"type"=>"keyword"},
      "user_data_bot"=>{"type"=>"boolean"},
      "user_data_domain"=>{"type"=>"keyword"},
      "user_data_gender"=>{"type"=>"keyword"},
      "user_data_gender_acc"=>{"type"=>"long"},
      "user_data_id"=>{"type"=>"keyword"},
      "user_data_multi_org_names"=>{"type"=>"keyword"},
      "user_data_name"=>{"type"=>"keyword"},
      "user_data_org_name"=>{"type"=>"keyword"},
      "user_data_user_name"=>{"type"=>"keyword"},
      "user_data_uuid"=>{"type"=>"keyword"},
      "user_domain"=>{"type"=>"keyword"},
      "user_email"=>{"type"=>"keyword"},
      "user_geolocation"=>{"type"=>"geo_point"},
      "user_location"=>{"type"=>"keyword"},
      "user_login"=>{"type"=>"keyword"},
      "user_name"=>{"type"=>"keyword"},
      "user_org"=>{"type"=>"keyword"},
      "uuid"=>{"type"=>"keyword"}}}
  end
end
